package com.lovo.practice_7_8;

import java.io.ObjectInputStream;
import java.util.Arrays;

public class Computer extends Role {
    //取机器的随机出拳并  根据机器的出拳设置 比较数组 的排序
    public String getFinger() {//取机器的随机出拳
        String result = "";
        result = getComputerArr()[(int) (Math.random() * 3 + 0)];
        if (result.equals("石头")) {//根据机器的出拳设置 比较数组的排序
            String[] arr = {"剪刀", "石头", "布"};
           setRoleArr(arr);
        } else if (result.equals("布")) {
            String[] arr = {"石头", "布", "剪刀"};
            setRoleArr(arr);
        } else if (result.equals("剪刀")) {
            String[] arr = {"布", "剪刀", "石头"};
            setRoleArr(arr);
        }

        return result;
    }


}
